<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:52:"D:\www\tp7./application/houtai\view\content\lst.html";i:1532678992;s:54:"D:\www\tp7./application/houtai\view\public\header.html";i:1504938710;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>樱桃的站点后台管理系统</title>  
<link rel="shortcut icon" href="__INDEX__/images/favicon.ico">
<link rel="stylesheet" href="__HOUTAI__/css/pintuer.css">
<link rel="stylesheet" href="__HOUTAI__/css/admin.css">

<script src="__HOUTAI__/js/jquery-2.1.4.min.js"></script>
<script src="__HOUTAI__/js/layer.js"></script>


<script src="__HOUTAI__/js/jquery.validate.js"></script>
<script src="__HOUTAI__/js/additional-methods.js"></script>
<script src="__HOUTAI__/js/messages_zh.js"></script>
<!-- 字体图标文件CSS -->
<link rel="stylesheet" type="text/css" href="//at.alicdn.com/t/font_394272_s1c3jukr7t10dx6r.css">
<!-- 字体图标文件js -->
<script type="text/javascript" src="//at.alicdn.com/t/font_394272_s1c3jukr7t10dx6r.js"></script>


<!-- <script type="text/javascript" src="http://malsup.github.io/jquery.form.js"></script> -->

</head>
<body>
<div class="panel admin-panel">
<div class="panel-head"><strong class="icon-menu"> 文章列表</strong></div>
<div class="padding border-bottom">
  <ul class="search" style="padding-left:10px;">
    <li> <a class="button border-main icon-tianjia" href="javascript:;" onclick="openifram('文章添加','100%','100%','<?php echo url('Content/add'); ?>')"> 文章添加</a> </li>
    <li><button type="button"  class="button border-green" id="checkall"><span class="icon-xuanze"></span> 全选</button></li>
    <li><button type="submit" class="button border-red" onclick="delall()" id="checkdel"><span class="icon-shanchu"></span> 批量删除</button></li>
    
  	<form action="<?php echo url('content/lst'); ?>" method="POST">
	  	<li>
		  	<select name="cid" class="input w50" id="options" style="width: 100%;">
		        <option value="0">请选择分类</option>
		        <?php if(is_array($Content) || $Content instanceof \think\Collection || $Content instanceof \think\Paginator): $i = 0; $__LIST__ = $Content;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
		        <option value="<?php echo $vo['id']; ?>"><?php echo $vo['name_display']; ?></option>
		        <?php endforeach; endif; else: echo "" ;endif; ?>
		    </select>
	    </li>
	    <li>
	  	<input type="text" placeholder="请输入搜索关键字" name="keywords" class="input" />
	  	</li>
	  	<li><button type="submit" class="button border-main" id="checkdel"><span class="icon-sousuo"></span> 搜索</button></li>
  	</form>
  </ul>
</div>
<form method="post" action="" id="listform">
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">ID</th>
        <th>图片</th>
        <th>标题</th>
        <th>作者</th>
        <th>所属栏目</th>
        <th>标签</th>
        <th width="10%">添加时间</th>
        <th width="10%">更新时间</th>
        <th width="310">操作</th>
      </tr>
      <?php if(is_array($article) || $article instanceof \think\Collection || $article instanceof \think\Paginator): $i = 0; $__LIST__ = $article;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
        <tr>
          <td style="text-align:left; padding-left:20px;"><input type="checkbox" name="id[]" value="<?php echo $vo['id']; ?>" /><?php echo $vo['id']; ?></td>
          <td width="10%"><img src="<?php echo $vo['thumb']; ?>" alt="" width="100" height="" /></td>
          <td><?php echo msubstr($vo['title'],0,26); ?></td>
          <td><font color="#00CC99"><?php echo $vo['author']; ?></font></td>
          <td><?php echo catname($vo['cateid']); ?></td>
          <td><font color="#00CC99"><?php echo $vo['tag']; ?></font></td>
          <td><?php echo date('Y-m-d',$vo['time']); ?></td>
          <td><?php echo date('Y-m-d',$vo['newtime']); ?></td>
          <td><div class="button-group"> <a class="button border-main" href="javascript:;" onclick="openifram('修改内容','100%','100%','<?php echo url('content/edit',['id'=>$vo['id']]); ?>')"><span class="icon-xiugai"></span> 修改</a> <a class="button border-red" href="javascript:void(0)" onclick="system_category_del(this,<?php echo $vo['id']; ?>)"><span class="icon-shanchu"></span> 删除</a> </div></td>
        </tr>
        <?php endforeach; endif; else: echo "" ;endif; ?>
    </table>
  </div>
  <?php echo $article->render(); ?>
</form>
<script type="text/javascript">

// 全选
jQuery(function($){
  //全选 
  $("#checkall").click(function(){ 
      $("input[name='id[]']").attr("checked","true"); 
      // $("input[name='checkbox']:checkbox:checked").each(function(){ 
      //     aa.push($(this).val());
      // })
      // console.log(aa);
      // aa= new Array();
  })
})
function delall(){
  layer.confirm('是否全部删除',function(){
    var ids= new Array(); 
    $("input[name='id[]']:checkbox:checked").each(function(){ 
      ids.push($(this).val());
    });
    var idj=ids.join(",")
    // alert(idj);
    $.ajax({
      type:"GET",
      url:"<?php echo url('content/delall'); ?>",
      data:{
        'id':idj,
      },
      success:function(data){
        var data=eval("("+data+")");
        if (data.status) {
          parent.layer.msg('删除成功~！',{icon:1,time:1000,},function(){parent.location.reload();});
        }else{
          parent.layer.msg('删除失败~！',{icon:2,time:1000,},function(){parent.location.reload();});
        }
      }
    })
  });
}

// 单个删除
function system_category_del(obj, id) {

  layer.confirm('确认要删除吗？', function (index) {

    $.ajax({
        type: "POST",
        url: "<?php echo url('content/del'); ?>",
        data: {
        'id':id,
        },
        dataType: "json",
        success: function(data){
          var data=eval("("+data+")");

        if (data.status == 1){

          parent.layer.msg('删除成功~！',{icon:1,time:1000,},function(){parent.location.reload();});
        
        }
        else{
        parent.layer.msg('删除失败~！',{icon:2,time:1000,},function(){parent.location.reload();});
        }
        }
      });
    });
}
function openifram(title,width,height,url){
		var index=layer.open({
		  type: 2,
		  title: title,
		  fixed:false,
		  area: [width, height],
		  shade: [0.2, '#393D49'],
		  maxmin: true,
		  content: url,
	});
	layer.full(index);//弹出就是全屏

}
</script>
</body>
</html>